home *** CD-ROM | disk | FTP | other *** search
/ Aminet 12 / Aminet 12 (1996)(GTI - Schatztruhe)[!][Jun 1996].iso / Aminet / misc / edu / Calgor.lha / Cal / Algorithms / while.c < prev   
Encoding:
C/C++ Source or Header  |  1996-03-19  |  1.0 KB  |  36 lines

  1. #include<hold/anim.h>
  2.  
  3. /* 000 */ void while_control(void){
  4. /* 001 */ int guard = 4;
  5. /* 002 */ int count = 0;
  6.  
  7.           a_func("while_control",0);
  8.           a_intini(guard,"guard",1);
  9.           a_intini(count,"count",2);
  10.           a_intcomp("count<4",3);
  11. /* 003 */   while(count<4){
  12. /* 004 */     guard--;
  13.               a_intass("guard","guard-1",4);
  14. /* 005 */     count++;
  15.               a_intass("count","count+1",5);
  16.               a_intcomp("count<4",3);
  17. /* 006 */   }
  18.             a_intcomp("count>3",7);
  19. /* 007 */   while(count>3){
  20. /* 008 */     guard++;
  21.               a_intass("guard","guard+1",8);
  22. /* 009 */     count--;
  23.               a_intass("count","count-1",9);
  24.               a_intcomp("count>3",7);
  25. /* 010 */   }
  26.             a_intcomp("count",11);
  27. /* 011 */   while(count){
  28. /* 012 */     guard++;
  29.               a_intass("guard","guard+1",12);
  30. /* 013 */     count--;
  31.               a_intass("count","count-1",13);
  32.               a_intcomp("count",11);
  33. /* 014 */   }
  34.             a_endfunc("while_control",15);
  35. /* 015 */ }
  36.